package edu.isquen.core.department.action;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import edu.isquen.core.base.model.ValueObject;
import edu.isquen.core.department.model.Department;
import edu.isquen.core.department.service.DepartmentService;
import edu.isquen.util.factory.ServiceFactory;


public class DepartmentUtil {

	public Map<String, String> getDeptList() throws Exception{
		Map<String, String> map=new HashMap<String, String>();
		map.put("", "——选择部门——");
		DepartmentService deptprocess=(DepartmentService) ServiceFactory.createProcess(DepartmentService.class);
		Collection<ValueObject> rolelist=deptprocess.doQuery().datas;
		for(Iterator<ValueObject> iter=rolelist.iterator();iter.hasNext();){
			Department dept=(Department) iter.next();
			if(dept!=null){
				map.put(dept.getId(), dept.getName());
			}
		}
		return map;
	}
}
